<?php 
defined('_JEXEC') or die;

// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();

?>
<div class="hr_position_top5" id="hr_position_top5">
	<div class="hr_position_top5inner">
   	<div class="hr_top5match">
         <div class="hr_top5uppoint"></div>
         <div class="closediv"></div>
      	<div class="hr_top5img"></div>
         <div class="hr_position_table hr_position_looktop5">
         	<table class="medium" width="100%" border="0" cellpadding="0" cellspacing="0">
            	<tr>
               	<th width="5%"></th>
                  <th width="7%" align="left">姓名</th>
                  <th width="20%" align="left">工作经验</th>
                  <th width="5%" align="left">学历</th>
                  <th width="11%" align="center">匹配度</th>
                  <th width="15%" align="center">应聘进度</th>
                  <th width="15%" align="center">申请时间</th>
               </tr>
               <?php $i=0; ?>
               <?php foreach($_['resumes'] as $resume): ?>
               <?php 
                     $match_degree_color = $resume->match_degree > 79 ? 'green' :
                        ($resume->match_degree > 49 ? 'blue' :
                         ($resume->match_degree > 0 ? 'orange' : 'gray')
                        );
                     $interview_progress_color = $resume->online_interview_completion > 90 ? 'blue' :
                               ($resume->online_interview_completion > 0 ? 'grayblue' : 'gray');
               ?>

               <tr data-id="<?php echo $resume->id; ?>" data-name="<?php echo $resume->name;?>">
               	<td><i class="<?php echo $i<3 ? "i_green": "i_blue"; ?>"><?=++$i?></i></td><!--  排名第一第二第三用i_green ,其余用i_blue -->
                  <td>
                     <a class="name" href="<?php echo $_['viewURL'].$resume->id.'&name='.JFilterOutput::stringURLUnicodeSlug($resume->name); ?>">
                        <span class="nametext"><?php echo htmlspecialchars($resume->name);?></span>
                     </a>
                  </td>
                  <td><?php echo $resume->workexp_summary; ?></td>
                  <td><?php echo $resume->highest_education_degree_level; ?></td>
                  <td align="center">
                     <?php
                        $online_interview_progress = json_decode($resume->online_interview_progress);
                        $online_interview_requirements = json_decode($resume->online_interview_requirements);
                        $title = ""; 
                        $degree = "";
                        if (isset($online_interview_progress->interview)) {
                           $degree = "<span>" . $resume->match_degree . "%</span>";
                        } else {
                           $title = "应聘者尚未回应，暂无匹配信息";
                           $degree = "<span>--%</span>";
                        }
                        ?>
                     <div class="match_degree_mask <?echo isset($online_interview_progress->interview) ? "matched click" : "nomatch"?>" title="<?=$title?>">
                     <?php echo $degree; ?>
                     <br/>
                     <div class="match_degree">
                        <div class="<?php echo $match_degree_color; ?>" style="width:<?php echo $resume->match_degree; ?>%;"></div>
                     </div>
                     </div>
                  </td>
                  <td align="center">
                      <?php
                        $requirementsCount = 0;
                        if (!empty($online_interview_requirements)) {
                        ?>
                        <div style="padding-left:15px;">
                           <?php 
                           if (isset($online_interview_requirements->onlinetest) && $online_interview_requirements->onlinetest): 
                              $requirementsCount++;
                           ?>
                           <?php 
                              $taken = isset($online_interview_progress->onlinetest) && $online_interview_progress->onlinetest; 
                              $class = $taken ? ($resume->is_reviewed ? 'done' : '') : 'gray';
                           ?>
                           <a href="<?php echo $taken ? OC_Helper::linkToRoute("resume_reviewpaper")."?id=".$resume->id : "javascript:;"?>" class="penciltest" target="<?=($taken ? '_blank': '')?>">
                              <i class="online_interview penceltest <?=$class?>" title="<?=($taken ? '': '未完成线上笔试')?>"></i>
                           </a>
                           <?php endif; ?>
                           <?php 
                           if (isset($online_interview_requirements->persontest) && $online_interview_requirements->persontest): 
                              $requirementsCount++;
                           ?>
                           <?php 
                              $taken = isset($online_interview_progress->persontest) && $online_interview_progress->persontest; 
                           ?>
                           <i class="online_interview persontest <?=($taken ? '' : 'gray')?>" title="<?=($taken ? '': '未完成性格评测')?>"></i>
                           <?php endif; ?>
                           <?php 
                           if (isset($online_interview_requirements->video) && $online_interview_requirements->video): 
                              $requirementsCount++;
                           ?>
                           <i class="online_interview videotest gray"></i>
                           <?php endif; ?>
                        </div>
                     <?php
                        }
                        if ($requirementsCount == 0) {
                           echo '<div title="应聘者还未进行线上评测" style="text-align:left; padding-left:42px;">--</div>';
                        }
                        ?>
                  
                  </td>
                  <td align="center">
                     <span class="modified" title="<?php echo JHtml::_('date',$resume->date_added, 'Y-m-d H:i:s'); ?>">
                        <?php echo JHtml::_('date',$resume->date_added, 'Y-m-d'); ?>
                     </span>
                  </td>
               </tr>
               <?php endforeach; ?>
            </table>
         </div>
         
         <div class="hr_top5checkmore medium"><a href="<?php echo $_['showmoreURL'];?>">查看更多</a></div>
      </div>
   </div>
</div>
